<template>
  <div class="img-viewer-box">
    <el-image-viewer v-if="dialogVisible" :url-list="props.imgs" @close="close" />
  </div>
</template>

<script lang="ts" setup>
import { computed } from "vue";

const props = defineProps({
  // 是否显示
  show: {
    type: Boolean,
    default: false,
  },
  // 图片列表
  imgs: {
    type: Array,
    default: () => [],
  },
});

const emits = defineEmits(["update:show"]);
const dialogVisible = computed(() => props.show); // 控制弹窗显示

// 关闭预览
const close = () => {
  emits("update:show", false);
};
</script>

<style scoped></style>
